home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Pascal / Snippets / vListMngr 1.0 / Sources ƒ / InitTheMenus < prev    next >
Encoding:
Text File  |  1996-04-10  |  1.9 KB  |  63 lines  |  [TEXT/PJMM]

  1. unit InitTheMenus;
  2.  
  3. {File name:  InitTheMenus}
  4. {Function: Pull in menu lists from a resource file.}
  5. {          This procedure is called once at program start.}
  6. {          AppleMenu is the handle to the Apple menu, it is also}
  7. {          used in the procedure that handles menu events.}
  8. {History: 6/5/92 Original by Prototyper.   }
  9.  
  10. interface
  11.  
  12.     procedure Init_My_Menus;            {Initialize the menus}
  13.  
  14.     var
  15.         AppleMenu: MenuHandle;           {Menu handle}
  16.         M_File: MenuHandle;              {Menu handle}
  17.         M_Edit: MenuHandle;              {Menu handle}
  18.  
  19. implementation
  20.  
  21.     procedure Init_My_Menus;            {Initialize the menus}
  22.         const
  23.             Menu1 = 1001;                   {Menu resource ID}
  24.             Menu2 = 1002;                   {Menu resource ID}
  25.             Menu3 = 1003;                   {Menu resource ID}
  26.         var
  27.             tStr: Str255;
  28.     begin                               {Start of Init_My_Menus}
  29.         ClearMenuBar;                   {Clear any old menu bars}
  30.  
  31.     { This menu is the APPLE menu, used for About and desk accessories.}
  32.         tStr := ' ';
  33.         tStr[1] := CHR(appleMark);
  34.         AppleMenu := NewMenu(Menu1, tStr);                    {Create apple menu }
  35.         AppendMenu(AppleMenu, 'About vListMngr Demo...');
  36.         InsertMenu(AppleMenu, 0);                                   {Insert this menu into the menu bar}
  37.         AddResMenu(AppleMenu, 'DRVR');                            {Add in DAs}
  38.  
  39.         M_File := NewMenu(Menu2, 'File');
  40.         AppendMenu(M_File, 'Show Headings/S');
  41.         AppendMenu(M_File, 'Clear Headings/K');
  42.         AppendMenu(M_File, '-');
  43.         AppendMenu(M_File, 'Quit/Q');
  44.         InsertMenu(M_File, 0);
  45.  
  46.         M_Edit := NewMenu(Menu3, 'Edit');
  47.         AppendMenu(M_Edit, 'Edit Cell Data');
  48.         AppendMenu(M_Edit, 'Refresh Cell Data');
  49.         AppendMenu(M_Edit, '-');
  50.         AppendMenu(M_Edit, '(Add Column');
  51.         AppendMenu(M_Edit, '(Delete Column');
  52.         AppendMenu(M_Edit, '-');
  53.         AppendMenu(M_Edit, 'Insert Row');
  54.         AppendMenu(M_Edit, 'Delete Row');
  55.         AppendMenu(M_Edit, '-');
  56.         AppendMenu(M_Edit, 'Frame Cells');
  57.         InsertMenu(M_Edit, 0);
  58.  
  59.         DrawMenuBar;    {Draw the menu bar}
  60.  
  61.     end;       {End of procedure Init_My_Menus}
  62.  
  63. end.    {End of this unit}